import {createAPI,createParamsAPI,createUploadAPI} from '@/utils/http'

export const login = data => createParamsAPI('/login/login', 'post', data)  //登录


export const getLoginUser = data => createParamsAPI('/login/token', 'post', data)  //获取登录用户信息

export const uploadImage = data => createAPI('/user/upload', 'post', data)  //上传图片


export const getEasyUserById = data => createAPI(`/user/easy/${data.id}`, 'post', data)  //获取用户的简单信息
export const getRating = data => createParamsAPI(`/user/rating`, 'post', data)  //获取用户rating积分排行榜


//查询用户列表
export const getUserList = data => createParamsAPI('/user/search','post',data);
export const addUser = data => createAPI('/user/save','post',data);
export const updateUserById = data => createAPI(`/user/update`,'put',data);
export const loginUpdateById = data => createAPI(`/user/loginUpdate`,'put',data); //不需要任何验证的修改
export const deleteUserById = data => createAPI(`/user/delete/${data.id}`,'delete',data);

// export const uploadProblem = data => createUploadAPI(`/problem/upload`, 'post', data)  //上传头像图片

//注册
export const register = data => createAPI(`/login/register/${data.code}`,'post',data.user);
export const sendEmailCode = data => createAPI(`/login/sendCode/${data.email}`,'post',data);  //发送验证码
export const sendEmailCodePut = data => createAPI(`/login/sendCode/${data.email}`,'put',data);  //发送验证码
export const setPassword = data => createParamsAPI(`/login/setPassword`,'post',data);  //重新设置密码
export const setEmail = data => createAPI(`/login/setEmail`,'post',data);  //重新设置密码


//session
export const getLastLoginSession = data => createParamsAPI(`/user/session/last`,'post',data);
export const getLastLoginSessionList = data => createParamsAPI(`/user/session/search`,'post',data);

